package com.chaoXing.work1;

public class Rect {

    private int w;
    private int h;
    private String color="black";


    

    public int getW() {
        return w;
    }

    public void setW(int w) {
        this.w = w;
    }

    public int getH() {
        return h;
    }

    public void setH(int h) {
        this.h = h;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public Rect() {
    }

    public Rect(int w, int h) {
        this.w = w;
        this.h = h;
    }

    public Rect(int w, int h, String color) {
        this.w = w;
        this.h = h;
        this.color = color;
    }

    public double getArea(){
        return w*h;
    }
    public double getPerimeter(){
        return (w*h)*2;
    }

    @Override
  public String toString() {
        return "******MyPriter is Canon-ip110" + "\n" +
                "Rect{" +
                "w=" + w +
                ", h=" + h +
                ", color='" + color + '\'' +
                "getArea()=" + this.getArea() + "\t\t" +
                "getPerimeter()=" + this.getPerimeter() +
                "}\n";


    }


}
